package cn.e2win.base.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;

public class CommonExceptionController {
	public static Log logger = LogFactory.getLog(CommonExceptionController.class);
	 /** 基于@ExceptionHandler异常处理 */  
    @ExceptionHandler  
    public String exp(HttpServletRequest request, Exception ex) {  
          
        request.setAttribute("ex", ex);
        ex.printStackTrace();
        logger.error(ex);
          
        // 根据不同错误转向不同页面  
        /*if(ex instanceof BusinessException) {  
            return "error-business";  
        }else if(ex instanceof ParameterException) {  
            return "error-parameter";  
        } else {  
            return "error";  
        }*/
        return "msg/common/fail";
    }  
}
